package com.asia5b.a5mall.order.adapter

import android.widget.TextView
import com.asia5b.a5mall.middleware.model.shop.AbsGoodsModel

import com.asia5b.a5mall.middleware.utils.CurrencyPriceBuilder3
import com.asia5b.a5mall.order.R
import com.asia5b.a5mall.order.databinding.ItemPlacegoodlistAdapterBinding
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
import com.chad.library.adapter.base.viewholder.BaseViewHolder

/**
 * Created by zhangyuncai on 2020/5/7.
 * 商品清单
 */
class PlaceGoodListAdapter(list: ArrayList<AbsGoodsModel>) :
        BaseQuickAdapter<AbsGoodsModel, BaseDataBindingHolder<ItemPlacegoodlistAdapterBinding>>(R.layout.item_placegoodlist_adapter, list) {
    override fun convert(helper: BaseDataBindingHolder<ItemPlacegoodlistAdapterBinding>, item: AbsGoodsModel) {
        var binding = helper.dataBinding!!
        binding.data = item


        //价格
        val tv_shopcar_price = helper.getView<TextView>(R.id.tv_orderplace_price)
        CurrencyPriceBuilder3().run{
            textView=tv_shopcar_price
            price=item.absGoodsPrice
            priceList=item.absGoodsPriceList
            build()
        }

        //数量
        val tv_orderplace_num = helper.getView<TextView>(R.id.tv_orderplace_num)
        tv_orderplace_num.text = String.format("X%s", item.absGoodsCurrentBuyNum)
    }
}